$(document).ready(function(){
	$(".tipTip").tipTip({
		maxWidth: "auto", 
		defaultPosition: "top",
		delay: 200,
		edgeOffset: 10
		});
//	$('img').lazyload({ 
//		placeholder : '/public/templates/public/default/images/no-image.png',
//		effect : 'fadeIn',
//	});
})


function toolTip(selector, value){
	
}

function loadError(selector, value) {
	var html = selector.parent().find('.frm_error').html();
	selector.parent().find('.frm_error').html(value);
	
}

function popupAlert(type, text){
	var elem = $('#popup-alert');
	elem.removeClass();
	elem.addClass('popup-' + type);
	elem.find('#content').html(text);
	elem.fadeIn(300).delay(4000).fadeOut(300);
}

function closePopup(){
	var elem = $('#close_popup');
	elem.parent().hide();
	return false;
}

/*========================================================
 * Fancy Box
 * elem => selector
 *========================================================*/
function fancyBox(elem, scroll){
	if(scroll == undefined){
		scroll = 'none';
		
	}
	elem 		= $(elem);
	if (!elem.data("fancybox")) {
		elem.data("fancybox", true);
		elem.fancybox({
			'titleShow' 	: false,
			'transitionIn'	: 'elastic',
			'transitionOut'	: 'elastic',
			'centerOnScroll': true,
			'scrolling'		: scroll,
//			'hideOnOverlayClick':false,
//			'hideOnContentClick':false,
			onComplete		: function(data){

			}
		}).trigger('click');
	}
	return false; 
}

/*=========================================================
 * Place holder
 * elem => selector
 * value => String what you want to show
 *=========================================================*/
function placeholder(elem, value){
	if(elem.val() == ''){
		elem.addClass('placeholder');
		elem.val(value);
		elem.focus(function(){
			if($(this).val() == '' || $(this).hasClass('placeholder')){
				$(this).val('');
				$(this).removeClass('placeholder');
			}
		});
		elem.blur(function(){
			if($(this).val() == ''){
				$(this).addClass('placeholder');
				$(this).val(value);
			}
		});
	}
}

function is_float(mixed_var) {
  return +mixed_var === mixed_var && (!isFinite(mixed_var) || !!(mixed_var % 1));
}

function is_int(mixed_var) {
	 return mixed_var === +mixed_var && isFinite(mixed_var) && !(mixed_var % 1);
}

